<!-- Ndas -->
<div class="main-window-segment" style="padding-top: none; padding-bottom: 20px;">
    <div class="container-fluid">
        <div class="row">

            <div class="col-lg-10 col-md-6 col-sm-12">
                <h2>Detail <?php echo $this->judul; ?> Per Akun</h2>
            </div>
			 
            <div class="col-lg-1 col-md-3 col-sm-12" style="padding-top: 20px;">
            <?php
			//----------------------------------------------------
			//Development History.Revisi : 0 Kegiatan :1.mencetak hasil filter ke dalam pdf Dibuat oleh : Rifan Abdul Rachman Tanggal dibuat : 18-07-2014  File yang diubah : monitoringUser.php  
			
		  if (isset($this->bln_awal)) {
				$kdbln_awal = $this->bln_awal;
            }else{
				$kdbln_awal ='null';
			}
			
			if (isset($this->bln_akhir)) {
				$kdbln_akhir = $this->bln_akhir;
            }else{
				$kdbln_akhir ='null';
			}
			if (isset($this->satker)) {
				$satker = $this->satker;
            }else{
				$satker ='null';
			}
			
			if (isset($this->akun)) {
				$akun = $this->akun;
            }else{
				$akun ='null';
			}
			if (isset($this->eselon1)) {
				$eselon1 = $this->eselon1;
            }else{
				$eselon1 ='null';
			}			
			if (isset($this->nodok)) {
				$kdnodok = $this->nodok;
            }else{
				$kdnodok ='null';
			} 
			
			$kdaksi = $this->action;
            $kdaksi1 = $kdaksi . '_BAES1_PDF';
			 
			
			
			?>
            <div class="btn-group-sm">
                <button type="button" class="btn btn-default dropdown-toggle fullwidth" data-toggle="dropdown" aria-expanded="false"><span class="glyphicon glyphicon-print"></span>&nbsp; Cetak <span class="caret"></span>
                </button>
                      <ul class="dropdown-menu" role="menu">
                        <li><a href="<?php echo URL; ?>PDF/<?php echo $kdaksi1; ?>/<?php echo $kdbln_awal . "/" . $kdbln_akhir . "/" . $akun . "/" . $eselon1 . "/" . $satker . "/" . $kdnodok; ?>/PDF">PDF</a></li>
                        <li><a href="<?php echo URL; ?>PDF/<?php echo $kdaksi1; ?>/<?php echo $kdbln_awal . "/" . $kdbln_akhir . "/" . $akun . "/" . $eselon1 . "/" . $satker . "/" . $kdnodok; ?>/XLS">EXCEL</a></li>
                      </ul>
            </div>
            
			<?php

			//----------------------------------------------------		
			?>
            </div>
            <div class="col-lg-1 col-md-3 col-sm-12" style="padding-top: 20px;">

                <button type="button" style="width: 100%" class="btn btn-default" data-toggle="modal" data-target="#modal-app-filter"><span class="glyphicon glyphicon-filter"></span> Filter</button>

            </div>
           
        </div>

        <div class="row" style="padding-top: 10px">

            <div class="col-md-6 col-sm-12">
                <?php
                if (isset($this->d_nama_kppn)) {
                    foreach ($this->d_nama_kppn as $kppn) {
                        echo $kppn->get_nama_user() . " (" . $kppn->get_kd_satker() . ")";
                        $kode_kppn = $kppn->get_kd_satker();
                    }
                } else {
                    echo Session::get('user');
                }
                if (isset($this->data)) {
					 foreach ($this->data as $value) {
				
						$AKUN = $value->get_akun();
					}
				}
				echo "<br> AKUN PENDAPATAN : " .$AKUN . " (" .$this->akun.")";
				
                if (isset($this->d_kd_satker)) {
                    echo "<br>Satker : " . $this->d_kd_satker;
                }
                ?>
            </div>

            <div class="col-md-6 col-sm-12" style="text-align: right;">
                <?php
                // untuk menampilkan last_update
                if (isset($this->last_update)) {
                    foreach ($this->last_update as $last_update) {
                        echo "Update Data Terakhir (Waktu Server)<br/>" . $last_update->get_last_update() . " WIB";
                    }
                }
                ?>
            </div>

        </div>

    </div>
</div>

<div id="table-container" class="wrapper">
    <table width="100%" class="footable">
        <!--baris pertama-->
        <thead>
            <tr>
                <th class="align-center">No.</th>
                <th class='align-center'>Kode Satker</th>
                <th>Nama Satker</th>
				<th>KPPN</th>
				<th>Tanggal</th>
				<th>No SP2D </th>
				<th>Nilai Potongan</th>
				
				
                
            </tr>
        </thead>
        <tbody>
            <?php
            $no = 1;
			$total = 0;
            //var_dump ($this->data);
            if (isset($this->data)) {
                if (empty($this->data)) {
                    echo '<td colspan=5 align="center">Tidak ada data.</td>';
                } else {
                    foreach ($this->data as $value) {
                        echo "<tr>	";
                        echo "<td class='align-center'>" . $no++ . "</td>";
                        echo "<td class='align-center'>" . $value->get_satker() . "</td>";
                        //echo "<td class='align-center'><a href=" . URL . "dataDIPA/RevisiDipa/" . $value->get_kdsatker() . "/" . $value->get_rev() . " >" . $value->get_kdsatker() . "</a></td>";
                        echo "<td class='align-left'>" . $value->get_nm_satker() . "</td>";	
						echo "<td class='align-left'>" . $value->get_kppn() . "</td>";
						echo "<td class='align-center'>" .$value->get_tgl(). "</td>";
                        echo "<td class='align-center'>" . $value->get_nodok() . "</td>";
						
						echo "<td class='ratakanan'>" . number_format($value->get_balancing_amt()) . "</td>";
                        echo "</tr>	";
						$total += $value->get_balancing_amt();
                    }
					
                }
            } else {
                echo '<td colspan=5 align="center" id="filter-first">Silahkan masukkan filter terlebih dahulu.</td>';
            }
            ?>
        </tbody>
		<tfoot>
			<tr>
				<td colspan='6'  class='ratatengah'><b>GRAND TOTAL<b></td>
				<td class='ratakanan'><b><?php echo number_format($total) ?><b></td>
			</tr>
		</tfoot>
    </table>
</div>

<div class="modal fade" id="modal-app-filter" tabindex="-1" role="dialog" aria-labelledby="app-filter-label" aria-hidden="true">

    <div class="modal-dialog">

        <div class="modal-content">

            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Tutup</span></button>
                <h4 class="modal-title" id="app-filter-label"><span class="glyphicon glyphicon-filter"></span> Filter Data</h4>

            </div>

            <form id="filter-form" method="POST" action="#" enctype="multipart/form-data">

                <div class="modal-body">
                                     
                    <br/>
                    <div id="winvoice" class="alert alert-danger" style="display:none;"></div>
                    <label class="isian">Kode Akun: </label>
                    <input class="form-control" type="text" name="akun" id="akun" value="<?php if (isset($this->akun)) {
    echo $this->akun;
} ?>">
                    <br/>
                    <label class="isian">No. NTPN/SP2D: </label>
                    <input class="form-control" type="text" name="nodok" id="nodok" value="<?php if (isset($this->nodok)) {
    echo $this->nodok;
} ?>">


                    <input type="hidden" name="kd_satker" id="kd_satker" value="<?php echo $kode_satker; ?>">
                    <input type="hidden" name="kd_kppn" id="kd_kppn" value="<?php echo $kode_kppn; ?>">
                    <input type="hidden" name="kd_adk_name" id="kd_adk_name" value="<?php echo $_FILES['fupload']['name']; ?>">
                    <input type="hidden" name="kd_jml_pdf" id="kd_jml_pdf" value="<?php echo '10'; ?>">
                    <input type="hidden" name="kd_file_name" id="kd_file_name" value="<?php echo $kode_satker . "_" . $kode_kppn . "_" . date("d-m-y") . "_"; ?>">


                </div>

                <div class="modal-footer">
                    <button type="submit" name="submit_file" class="btn btn-primary" style="width: 100%" onClick="return cek_upload()">Kirim</button>
                </div>

            </form>

        </div>

    </div>

</div>

<script type="text/javascript">
    $(function() {
        hideErrorId();
        hideWarning();

    });

    function cek_upload() {
        if ($('#kdsatker').val().length > 0) && ($('#kdsatker').val().length != 6)  {
            $('#winvoice').html('Kode Satker harus 6 digit.');
            $('#winvoice').fadeIn();
            jml++;
        }
        if (jml > 0) {
            return false;
        }
    }

    function hideErrorId() {
        $('.error').fadeOut(0);
    }

    function hideWarning() {
        $('#invoice').keyup(function() {
            if (document.getElementById('invoice').value != '') {
                $('#winvoice').fadeOut(200);
            }
        });

    }

</script>